package com.sh.caryr.erp.exception;

import com.sh.caryr.erp.entity.ResultMessage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.http.HttpStatus;

@EqualsAndHashCode(callSuper = true)
@Data
public class RestServiceException extends RuntimeException {

    HttpStatus httpStatus;

    ResultMessage resultMessage = new ResultMessage();


    public RestServiceException(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }

    public RestServiceException(ResultCode msgCode) {
        resultMessage.setMsgCode(msgCode);
    }

    public RestServiceException(HttpStatus httpStatus, ResultCode msgCode) {
        this.httpStatus = httpStatus;
        resultMessage.setMsgCode(msgCode);
    }

}
